import path = require('path');
import PWSApp from './core/app';
import * as utils from './core/utils';
import {Magics} from "./core/magics";

function main() {
    let env = process.env;
    //noinspection TypeScriptUnresolvedVariable
    let name = env.NAME || Magics.AllInOne;
    // noinspection TypeScriptUnresolvedVariable
    let bind = utils.isIP(env.BIND + '') ? env.BIND : '127.0.0.1';
    // noinspection TypeScriptUnresolvedVariable
    let port = utils.toInt(env.PORT) > 0 ? utils.toInt(env.PORT) : 8000;

    let app: PWSApp = new PWSApp(name, port, bind);
    app.run();
}

main();
